<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>门店管理</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<!--公共JS开始-->
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<!--公共JS结束-->
<!--数据列表插件开始-->
<link href="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.ui.position.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.js"></script>
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Css/etgrid.css">
<script src="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Js/etgrid.js"></script>
<!--数据列表插件结束-->
<style type="text/css">
	body {
		overflow:hidden;
	}
	.table_box {
	}
</style>
</head>

<body>
	<div class="table_tool">
		<ul class="clearfix">			

			<li class="openwin btn" etitle="新建门店" eheight="300px" ewidth="700px" ehref="{:U('Company/outletAdd')}" id="Company_outletAdd"><i class="icon-plus"></i>新建门店</li>
			<li class="line"></li>

		</ul>
	</div>
	<div class="table_box">
	</div>
</body>
<script type="text/javascript">
	var listConfig = {
			showPageNav: false,
			blockBox : '.table_box',
			blockBoxHeight : 'window',
			jsonUrl : '__URL__/outlet',
			where : '',
			getWhere : function(){
				return '';
			},
			widthType : 'tdw', //thw-标题标准宽度、tdw-数据单元标准宽度、auto-随数据单元宽度
			pageNum : 10,
			nowPage : 1,
			orderName : "addtime",
			orderDirection : "desc",
			dataContextMenuOpen: true, //是否开启数据行右键菜单
			dataContextMenu: function(){
				$.contextMenu({
					selector: '.et_tbody tr',
					items: {
						"edit": {
							name: "修改", 
							icon: "edit",
							callback: function(key, options) {
								var href = "{:U('Company/outletEdit')}&id="+$(this).attr('rowid');
								var width = '700px';
								var height = '300px';
								var title = '修改门店';
								openDialog('Company_outletEdit',href,width,height,title);
							}
						},
						
						"delete": {
							name: "删除", 
							icon: "del",
							callback: function(key, options) {
								var href = "__URL__/outletDel";
								var id   = $(this).attr('rowid');
								$.post(href,{id:id},function(data){
									if(data.status == 1){
										$('.et_tfoot .page_refresh').click();
									}else{
										windowApi.lhgdialog.alert(data.info);
									}
								});
							}
						}
						
					}
				});
			},
			colModel : [
				{
					display : 'checkbox',
					name : 'id',
					sortable : true,
					myclass : 'center',
					edit : false
				},
				{
					display : '门店名称',
					name : 'title',
					sortable : false,
					myclass : 'center',
					edit : false
				},
				{
					display : '固定电话',
					name : 'tel',
					sortable : true,
					myclass : 'center',
					edit : false
				},
				{
					display : '手机号码',
					name : 'mobile',
					sortable : true,
					myclass : 'center',
					edit : false
				},
				{
					display : '邮箱',
					name : 'email',
					sortable : true,
					myclass : 'center',
					edit : false
				},
				{
					display : '时间',
					name : 'addtime',
					sortable : true,
					myclass : 'center',
					edit : false
				}
			]
		};
	
	//实例化列表
	var tableList = $('.table_box').EtGrid(listConfig);
	//tableList.erefresh();
	
	//批量删除
	$('.memberDel').on('click',function(){
		var val = '';
		$('.et_tbody .chk_item:checked').each(function(index, element) {
			if(val){
				val += ','+$(this).val();
			}else{
				val += $(this).val();
			}
		});
		alert(val);
	});
	
	//移动到分组
	$('.memberGroup .submenu>li').on('click',function(){
		var val = '';
		$('.et_tbody .chk_item:checked').each(function(index, element) {
			if(val){
				val += ','+$(this).val();
			}else{
				val += $(this).val();
			}
		});
		
		alert('将Id为'+val+'的数据移动到Id为'+$(this).attr('toid')+'的会员分组');
	});
	
	//打开统计图表
	$('.memberChart').on('click',function(){
		var href = 'memberAdd.html?id='+$(this).attr('rowid');
		var width = '900px';
		var height = '500px';
		var title = '统计图表';
		openDialog('memberChart',href,width,height,title);
	});
</script>
</html>
